package io;

import javax.sound.sampled.Line;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**
 * 简易记事本工具
 */
public class NoteDemo {
    public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入文件名");
        String wj=sc.nextLine();
        System.out.println("输入内容");
        FileOutputStream fos=new FileOutputStream(wj);
        OutputStreamWriter osw=new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw=new BufferedWriter(osw);
        PrintWriter pw=new PrintWriter(bw,true);
        while (true){
            String nr=sc.nextLine();
            if ("exit".equals(nr)){
                break;
            }
            pw.println(nr);
        }
        System.out.println("再见!");
        pw.close();

    }
}
